| Server IP : 43.153.74.48 / Your IP : 216.73.216.28 Web Server : LiteSpeed System : Linux VM-0-13-ubuntu 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 User : www ( 1002) PHP Version : 8.1.29 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/stainlesstint.com/wp-content/themes/woodmart/js/scripts/global/ |
Upload File : |
/* global woodmart_settings */
(function($) {
woodmartThemeModule.$document.on('wdHiddenSidebarsInited', function() {
woodmartThemeModule.lazyLoading();
});
$.each([
'frontend/element_ready/wd_products.default',
'frontend/element_ready/wd_products_tabs.default',
'frontend/element_ready/wd_product_categories.default',
'frontend/element_ready/wd_products_brands.default',
'frontend/element_ready/wd_blog.default',
'frontend/element_ready/wd_images_gallery.default',
'frontend/element_ready/wd_product_categories.default',
'frontend/element_ready/wd_slider.default',
'frontend/element_ready/wd_banner_carousel.default',
'frontend/element_ready/wd_banner.default',
'frontend/element_ready/wd_infobox_carousel.default',
'frontend/element_ready/wd_infobox.default',
'frontend/element_ready/wd_instagram.default',
'frontend/element_ready/wd_testimonials.default'
], function(index, value) {
woodmartThemeModule.wdElementorAddAction(value, function() {
woodmartThemeModule.lazyLoading();
});
});
woodmartThemeModule.lazyLoading = function() {
if (!window.addEventListener || !window.requestAnimationFrame || !document.getElementsByClassName) {
return;
}
var pItem = document.getElementsByClassName('wd-lazy-load'), pCount, timer;
woodmartThemeModule.$document.on('wood-images-loaded added_to_cart updated_checkout', function() {
inView();
});
// Fix for menu.
woodmartThemeModule.$body.on('click', '.wd-header-mobile-nav > a, .wd-nav-opener, .wd-btn-show-cat', function() {
woodmartThemeModule.$document.trigger('wood-images-loaded');
});
$('.wd-scroll-content').on('scroll', function() {
woodmartThemeModule.$document.trigger('wood-images-loaded');
});
// WooCommerce tabs fix
$('.wc-tabs > li').on('click', function() {
woodmartThemeModule.$document.trigger('wood-images-loaded');
});
// scroll and resize events
window.addEventListener('scroll', scroller, false);
window.addEventListener('resize', scroller, false);
// DOM mutation observer
if (MutationObserver) {
var observer = new MutationObserver(function() {
if (pItem.length !== pCount) {
inView();
}
});
observer.observe(document.body, {
subtree : true,
childList : true,
attributes : true,
characterData: true
});
}
// initial check
inView();
// throttled scroll/resize
function scroller() {
timer = timer || setTimeout(function() {
timer = null;
inView();
}, 100);
}
// image in view?
function inView() {
if (pItem.length) {
requestAnimationFrame(function() {
var offset = parseInt(woodmart_settings.lazy_loading_offset);
var wT = window.pageYOffset, wB = wT + window.innerHeight + offset, cRect, pT, pB, p = 0;
while (p < pItem.length) {
cRect = pItem[p].getBoundingClientRect();
pT = wT + cRect.top;
pB = pT + cRect.height;
if (wT < pB && wB > pT && !pItem[p].loaded) {
loadFullImage(pItem[p], p);
} else {
p++;
}
}
pCount = pItem.length;
});
}
}
// replace with full image
function loadFullImage(item) {
item.onload = addedImg;
if (item.querySelector('img') !== null) {
item.querySelector('img').onload = addedImg;
item.querySelector('img').src = item.dataset.woodSrc;
item.querySelector('source').srcset = item.dataset.woodSrc;
if (typeof (item.dataset.srcset) != 'undefined') {
item.querySelector('img').srcset = item.dataset.srcset;
}
}
item.src = item.dataset.woodSrc;
if (typeof (item.dataset.srcset) != 'undefined') {
item.srcset = item.dataset.srcset;
}
item.loaded = true;
// replace image
function addedImg() {
requestAnimationFrame(function() {
item.classList.add('wd-loaded');
var $masonry = jQuery(item).parents('.view-masonry .gallery-images, .grid-masonry, .masonry-container');
if ($masonry.length > 0) {
$masonry.isotope('layout');
}
var $categories = jQuery(item).parents('.categories-masonry');
if ($categories.length > 0) {
$categories.packery();
}
});
}
}
};
$(document).ready(function() {
woodmartThemeModule.lazyLoading();
});
})(jQuery);